<!DOCTYPE html>
<html>
<head>
	<title>JQuery-validation demo | Bootstrap</title>
<meta charset="utf-8"/>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" /> 
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="col-sm-8 col-sm-offset-2">
				<div class="page-header">
					<div class="alert alert-info" role="alert">
						<h4>This demo shows how to integrate JQuery-validation and the Bootstrap framework.</h4>
						<ul>
							<li><a href="https://getbootstrap.com/" class="alert-link">Bootstrap home project</a>.</li>
						</ul>
					</div>
				</div>

				<div class="panel panel-default">
					<div class="panel-heading">
						<h3 class="panel-title">Simple Form</h3>
					</div>
					<div class="panel-body">
					<!-- 	errorElement: "em",
									errorPlacement: function ( error, element ) {
										// Add the `help-block` class to the error element
										error.addClass( "help-block" );
					
										if ( element.prop( "type" ) === "checkbox" ) {
					error.insertAfter( element.parent( "label" ) );
										} else {
					error.insertAfter( element );
										}
									},
									highlight: function ( element, errorClass, validClass ) {
										$( element ).parents( ".col-sm-5" ).addClass( "has-error" ).removeClass( "has-success" );
									},
									unhighlight: function (element, errorClass, validClass) {
										$( element ).parents( ".col-sm-5" ).addClass( "has-success" ).removeClass( "has-error" );
									} -->
						<form method="post" class="form-horizontal validate-form" validate-options="
						onsubmit:function(form1){console.info(form1);},
						errorElement:'em', 
						success:function(label,element){
						if(!$(element).next('span')[0]){
						$('<span class=\'glyphicon glyphicon-ok form-control-feedback\'></span>').insertAfter($(element));
						}},errorPlacement:function(error,element){error.addClass('help-block');element.parents('.col-sm-5').addClass('has-feedback');if(element.prop('type')=== 'checkbox'){error.insertAfter(element.parent('label'));}else{error.insertAfter(element);}if(!element.next('span')[ 0 ]){$('<span class=\'glyphicon glyphicon-remove form-control-feedback\'></span>').insertAfter(element);}},
						highlight:function(element,errorClass,validClass){
						$(element).parents('.col-sm-5').addClass('has-error').removeClass('has-success');
						$(element).next('span').addClass('glyphicon-remove').removeClass('glyphicon-ok');
						},
						unhighlight:function(element,errorClass,validClass){
						$(element).parents('.col-sm-5').addClass('has-success').removeClass('has-error');
						$(element).next('span').addClass('glyphicon-ok').removeClass('glyphicon-remove');
						}" action="">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="firstname">First name</label>
								<div class="col-sm-5">
									<input type="text" validate-options="rules:{required:true,minlength:6},messages:{required:用户名必填}" class="form-control" name="firstname" placeholder="First name" />
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-4 control-label" for="lastname">Last name</label>
								<div class="col-sm-5">
									<input type="text" class="form-control" name="lastname" placeholder="Last name" />
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-4 control-label" for="username">Username</label>
								<div class="col-sm-5">
									<input type="text" class="form-control" name="username" placeholder="Username" />
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-4 control-label" for="email">Email</label>
								<div class="col-sm-5">
									<input type="text" class="form-control" name="email" placeholder="Email" />
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-4 control-label" for="password">Password</label>
								<div class="col-sm-5">
									<input type="password" class="form-control" name="password" placeholder="Password" />
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-4 control-label" for="confirm_password">Confirm password</label>
								<div class="col-sm-5">
									<input type="password" class="form-control" name="confirm_password" placeholder="Confirm password" />
								</div>
							</div>

							<div class="form-group">
								<div class="col-sm-5 col-sm-offset-4">
									<div class="checkbox">
										<label>
											<input type="checkbox" validate-options="rules:{required:true}" name="agree" value="agree" />Please agree to our policy
										</label>
									</div>
								</div>
							</div>

							<div class="form-group">
								<div class="col-sm-9 col-sm-offset-4">
									<button type="submit" class="btn btn-primary" name="signup" value="Sign up">Sign up</button>
								</div>
							</div>
						</form>
					</div>
				</div> 
			</div>
		</div>
	</div> 
	<script type="text/javascript" src="./jquery.v1.10.2.js"></script> 
	<script type="text/javascript" src="./jquery.validate.js"></script>
	<script type="text/javascript" src="./localization/messages_zh.js"></script>
	<script type="text/javascript" src="./jquery.validate.extends.js"></script>
</body>
</html>
